Viking gear
Gear Gifts and Apparel
Till death do us part
Axels New Music releases
Sharp Stuff
Switchblades Icepicks and german knives
PHP Gallery
PHP Gallery is a free php image script.

here are some of the best and useful php scripts and snippets to help in your projects. Php displayed below. Use the search for specific script lookups. Click the category links to view scripts in Javascript and cgi. To add your own script click the link and add your useful script example.

file extension check function. checks file extension for uploads and compares to your restictions do not trust file type with uploads
file extention function check extension uploads security
check file extension added on 3-09-14

<?php
function getExtension($str) {
$i strrpos($str,".");
if (!
$i) { return ""; }
$l strlen($str) - $i;
$ext substr($str,$i+1,$l);
return 
$ext;
}

$filename stripslashes($_FILES['ufile']['name']);
//get the extension of the file in a lower case format
$extension getExtension($filename);
$extension strtolower($extension);
//if it is not a known extension, we will suppose it is an error and will not upload the file,
//otherwise we will do more tests
if ($extension != "ogg")
{
//print error message
echo '<h1>Unknown or unallowed file type!</h1>';
exit;
}
?>


Add your comment.













No comments yet

Search ScriptsnTips


Php JavaScripts CGI/Perl